﻿
Public Class KeyValuePairs
    Implements IComparable

    Private _key As Object
    Private _value As Object
    Private _others() As Object
    Public Sub New(Key As Object, Value As Object, ParamArray Others() As Object)
        _key = Key
        _value = Value
        _others = Others
    End Sub
    Public Property Key As Object 'String
        Get
            Return _key
        End Get
        Set(value As Object)
            _key = value
        End Set
    End Property
    Public Property Value As Object 'Decimal
        Get
            Return _value
        End Get
        Set(value As Object)
            _value = value
        End Set
    End Property

    Public Property Others() As Object
        Get
            Return _others
        End Get
        Set(value As Object)
            _others = value
        End Set
    End Property

    Public Overloads Function Equals(obj As KeyValuePairs) As Boolean
        If Key = obj.Key AndAlso Value = obj.Value Then
            Return True
        Else
            Return False
        End If
    End Function

    Public Function CompareTo(obj As Object) As Integer Implements System.IComparable.CompareTo
        Try
            Dim temp As KeyValuePairs = obj
            If temp.Key.GetType.Equals(GetType(Integer)) Then
                Dim int1 As Integer = Key
                Dim int2 As Integer = temp.Key
                Return int1 - int2
            End If
            Return 0
        Catch ex As Exception
            Return 0
        End Try
    End Function
End Class